﻿using NWNT.Dal;
using NWNT.Dal.Database;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace NWNT.Web.Controllers
{
    public class BehaviouralDisordersController : Controller
    {
        private NWNT.Dal.IUnitOfWork uow;

        private MediaPartialModel GetMedia()
        {
            IQueryable<Media> model = uow.MediaRepository.GetAll();

            MediaPartialModel result = new MediaPartialModel()
            {
                SecondaryMedia1 = from PM in model.Where(m => m.MediaTypeId == 2)
                                  select new SecondaryMediaModel
                                  {
                                      MediaId = PM.MediaId,
                                      Header1 = PM.Header1,
                                      Header2 = PM.Header2
                                  },
                SecondaryMedia2 = from PM in model.Where(m => m.MediaTypeId == 3)
                                  select new SecondaryMediaModel
                                  {
                                      MediaId = PM.MediaId,
                                      Header1 = PM.Header1,
                                      Header2 = PM.Header2
                                  }

            };

            return result;
        }

        public BehaviouralDisordersController()
        {
            this.uow = new UnitOfWork();
        }

        // GET: BehaviouralDisorders 
        public ActionResult Index()
        {
            ViewBag.Quotes = uow.QuoteRepository.GetAll().Where(m => m.IsActive).OrderBy(m => m.Order).Select(m => m.Quote1).ToList();
            ViewBag.Media = GetMedia();
            return View();
        }

        public ActionResult MentalIllness()
        {
            ViewBag.Quotes = uow.QuoteRepository.GetAll().Where(m => m.IsActive).OrderBy(m => m.Order).Select(m => m.Quote1).ToList();
            ViewBag.Media = GetMedia();
            return View();
        }

        public ActionResult Alcoholism()
        {
            ViewBag.Quotes = uow.QuoteRepository.GetAll().Where(m => m.IsActive).OrderBy(m => m.Order).Select(m => m.Quote1).ToList();
            ViewBag.Media = GetMedia();
            return View();
        }

        public ActionResult OCD()
        {
            ViewBag.Quotes = uow.QuoteRepository.GetAll().Where(m => m.IsActive).OrderBy(m => m.Order).Select(m => m.Quote1).ToList();
            ViewBag.Media = GetMedia();
            return View();
        }

        public ActionResult Bipolar()
        {
            ViewBag.Quotes = uow.QuoteRepository.GetAll().Where(m => m.IsActive).OrderBy(m => m.Order).Select(m => m.Quote1).ToList();
            ViewBag.Media = GetMedia();
            return View();
        }

        public ActionResult Panic()
        {
            ViewBag.Quotes = uow.QuoteRepository.GetAll().Where(m => m.IsActive).OrderBy(m => m.Order).Select(m => m.Quote1).ToList();
            ViewBag.Media = GetMedia();
            return View();
        }

        public ActionResult Depression()
        {
            ViewBag.Quotes = uow.QuoteRepository.GetAll().Where(m => m.IsActive).OrderBy(m => m.Order).Select(m => m.Quote1).ToList();
            ViewBag.Media = GetMedia();
            return View();
        }

        public ActionResult Schizophrenia()
        {
            ViewBag.Quotes = uow.QuoteRepository.GetAll().Where(m => m.IsActive).OrderBy(m => m.Order).Select(m => m.Quote1).ToList();
            ViewBag.Media = GetMedia();
            return View();
        }

        public ActionResult DrugAbuse()
        {
            ViewBag.Quotes = uow.QuoteRepository.GetAll().Where(m => m.IsActive).OrderBy(m => m.Order).Select(m => m.Quote1).ToList();
            ViewBag.Media = GetMedia();
            return View();
        }

        public ActionResult SocialPhobia()
        {
            ViewBag.Quotes = uow.QuoteRepository.GetAll().Where(m => m.IsActive).OrderBy(m => m.Order).Select(m => m.Quote1).ToList();
            ViewBag.Media = GetMedia();
            return View();
        }

        public ActionResult GAD()
        {
            ViewBag.Quotes = uow.QuoteRepository.GetAll().Where(m => m.IsActive).OrderBy(m => m.Order).Select(m => m.Quote1).ToList();
            ViewBag.Media = GetMedia();
            return View();
        }

        public ActionResult Stress()
        {
            ViewBag.Quotes = uow.QuoteRepository.GetAll().Where(m => m.IsActive).OrderBy(m => m.Order).Select(m => m.Quote1).ToList();
            ViewBag.Media = GetMedia();
            return View();
        }

        public ActionResult LearningDisability()
        {
            ViewBag.Quotes = uow.QuoteRepository.GetAll().Where(m => m.IsActive).OrderBy(m => m.Order).Select(m => m.Quote1).ToList();
            ViewBag.Media = GetMedia();
            return View();
        }
    }
}